package pms.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import pms.dao.EventDao;
import pms.dao.TheaterDao;
import pms.om.Event;
import pms.om.Theater;


/** 
 * Controller to generate the Home Page basics to be rendered by a view. 
 * It extends the convenience class AbstractController that encapsulates most 
 * of the drudgery involved in handling HTTP requests. 
 * @author KRS DEV Team (krsdevteam@PMSWIbb2011SS.de)
 */
public class EditTheater extends AbstractController {
	private TheaterDao theaterDao;

	public void setTheaterDao(TheaterDao theaterDao) {
		this.theaterDao = theaterDao;
	}

	protected ModelAndView handleRequestInternal(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		ModelAndView mv = new ModelAndView();
		mv.addObject("privileged", httpServletRequest.isUserInRole("admin"));
		mv.addObject("title", "Neues Theater anlegen");
		mv.addObject("message", "Sie befinden sich im Admin-Bereich. Hier können Sie eine neues Theater anlegen.");
		mv.addObject(new Theater("Neues Theater"));
		mv.setViewName("edit-theater");
		return mv;
	}

}
